cc.Class({
    extends: cc.Component,
    properties: {
        spTile: {
            default: null,
            type: cc.Sprite
        },
        tileRes: "",
        tileScale: 1,
        _isYellow: !1,
        _tileValue: 0,
        _spBg: null
    },
    onLoad: function () {
        this._isYellow = !1, Global.notificationCenter.on(Global.eventName.GAME_RESET_TILE_YELLOW, this._onResetYellowTile.bind(this), this),
            Global.notificationCenter.on(Global.eventName.GAME_UPDATE_SELECT_TILE, this._onSelected.bind(this), this),
            this._spBg = this.node.getChildByName("spBg");
    },
    start: function () {
    },
    update: function (e) {
        1 == this._isYellow ? this.setYellow() : this.setWhite();
    },
    setWhite: function () {
        this.spTile && (this.spTile.node.color = cc.color(255, 255, 255, 255)), this._spBg && (this._spBg.color = cc.color(255, 255, 255, 255));
    },
    setYellow: function () {
        this.spTile && (this.spTile.node.color = cc.color(205, 216, 75, 255)), this._spBg && (this._spBg.color = cc.color(205, 216, 75, 255));
    },
    _onResetYellowTile: function () {
        this._isYellow = !1;
    },
    _onSelected: function (e) {
        this._tileValue == e.tileValue ? this._isYellow = !0 : this._isYellow = !1;
    },
    bindData: function (e) {
        this._tileValue = e;
        var t = this.tileRes + e, n = this.spTile.getComponent("cc.Sprite"), o = null;
        this.tileRes.indexOf("mj_az") >= 0 && (o = "Texture/mj_az_tiles"), this.tileRes.indexOf("mj_ar") >= 0 && (o = "Texture/mj_ar_tiles"),
        this.tileRes.indexOf("mj_al") >= 0 && (o = "Texture/mj_al_tiles"), this.tileRes.indexOf("mj_ad") >= 0 && (o = "Texture/mj_ad_tiles"),
            Global.spriteAtlas.setSpriteFrame(n, o, t), this.node.scaleX = this.tileScale, this.node.scaleY = this.tileScale;
    }
})
